import { requestClient } from '#/api/request';

export function AddObj(form: any) {
  form.tokenSettings = {
    accessTokenTimeToLive: form.accessTokenTimeToLive,
    refreshTokenTimeToLive: form.refreshTokenTimeToLive,
  };
  return requestClient.post(`/iam/registered-client`, form);
}

export function DelObj(id: string) {
  return requestClient.delete(`/iam/registered-client/${id}`);
}

export function UpdateObj(form: any) {
  form.tokenSettings = {
    accessTokenTimeToLive: form.accessTokenTimeToLive,
    refreshTokenTimeToLive: form.refreshTokenTimeToLive,
  };
  return requestClient.put(`/iam/registered-client/${form.id}`, form);
}

export function GetPage(query: any) {
  return requestClient.post(`/iam/registered-client/page`, {
    page: { current: query.current, size: query.size },
    model: {
      clientId: query?.clientId,
      clientName: query?.clientName,
      status: query?.status,
    },
  });
}
